package net.runsystem.magiccloud;

import net.runsystem.magiccloud.adapter.OnFragmentClickListener;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;

public class A05_Pass extends Fragment implements OnClickListener {
	public static final int A05_FRAGMENT_CODE = 105;

	OnFragmentClickListener onFragmentClickListener;

	ImageView btback;
	ImageView btsent;

	EditText texttel;
	EditText textemail;

	View root;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		Log.e("A02_Login", "View onCreateView");
		// TODO Auto-generated method stub
		// return super.onCreateView(inflater, container, savedInstanceState);
		root = inflater.inflate(R.layout.a05_layout, container, false);
		btback = (ImageView) root.findViewById(R.id.a05_bt_back);
		btsent = (ImageView) root.findViewById(R.id.a05_bt_sent);

		texttel = (EditText) root.findViewById(R.id.a05_text_tel);
		textemail = (EditText) root.findViewById(R.id.a05_text_email);

		btback.setOnClickListener(this);
		btsent.setOnClickListener(this);

		return root;
	}

	@Override
	public void onClick(View arg0) {
		// TODO Auto-generated method stub
		switch (arg0.getId()) {
		case R.id.a05_bt_back:
			// next page
			if (onFragmentClickListener != null) {
				onFragmentClickListener.onSwitchFragment(
						A02_Login.A02_FRAGMENT_CODE, null);
			}
			break;
		case R.id.a05_bt_sent:

			break;
		default:
			break;
		}
	}

	@Override
	public void onAttach(Activity activity) {
		// TODO Auto-generated method stub
		super.onAttach(activity);
		try {
			onFragmentClickListener = (OnFragmentClickListener) activity;
		} catch (ClassCastException e) {
			throw new ClassCastException(activity.toString()
					+ " must implement OnFragmentClickListener");
		}
	}
}
